package com.ludomancy.starwave;

import java.awt.Graphics;

import com.ludomancy.gamelib.ImageAnimation;
import com.ludomancy.gamelib.Sound;

public class ExplosionAnimation implements Animation
{
	private Ship corpse;
	private ImageAnimation anim;
	
	public ExplosionAnimation(Ship ship)
	{
		this.corpse = ship;
		anim = new ImageAnimation(Settings.getExplosion(ship.owner.direction), Settings.EXPLOSION_FRAME_TIME);
		if(ship.isDead())
		{
			anim.play();
			new Sound("blow.wav").play();
		}
	}
	
	public void start()
	{
		
	}
	
	public void update()
	{
		anim.update();
	}
	
	public boolean isOver()
	{
		return anim.isOver();
	}
	
	public void paint(Graphics g)
	{
		int x = corpse.px * Settings.TILE_SIZE;
		int y = corpse.py * Settings.TILE_SIZE;
		anim.paintCurrentFrame(g, x, y);
	}
}
